window.onload=function(){
	//var aPicLi=document.getElementById('pic_list').getElementsByTagName('li');
	var aTextLi=document.getElementById('text_list').getElementsByTagName('li');
	var aIcoLi=document.getElementById('ico_list').getElementsByTagName('li');
	var oIcoUl=document.getElementById('ico_list').getElementsByTagName('ul')[0];
	var oPrev=document.getElementById('btn_prev');
	var oNext=document.getElementById('btn_next');
	var iPrev=document.getElementById('icon-prev');
	var iNext=document.getElementById('icon-next');
	var oDiv=document.getElementById('limit_box');
	var investSum=document.getElementsByName('investSum');
	var i=0;
	var iNowUlLeft=0;
	var iNow=0;
	
	if(aIcoLi.length<3){
		oPrev.style.display='none';
		oNext.style.display='none';
	}
	else{
		$(".limit_con>ul>li").css('float', 'left');
		$(".limit_con>ul").css('width', '1024px');
	oPrev.onclick=function(){
		if(iNowUlLeft>0){
			iNowUlLeft--;
			oUlleft();
		}
		oPrev.className=iNowUlLeft==0?'btn_scroll':'btn_scroll showBtn';
		oNext.className=iNowUlLeft==(aIcoLi.length-3)?'btn_scroll':'btn_scroll showBtn';
		iPrev.className=iNowUlLeft==0?'icon-prev':'icon-prev2';
		iNext.className=iNowUlLeft==(aIcoLi.length-3)?'icon-next2':'icon-next';
	}
	
	oNext.onclick=function(){
		if(iNowUlLeft<aIcoLi.length-3){
			iNowUlLeft++;
			oIcoUl.style.left=-aIcoLi[0].offsetWidth*iNowUlLeft+'px';
		}
		oPrev.className=iNowUlLeft==0?'btn_scroll':'btn_scroll showBtn';
		oNext.className=iNowUlLeft==(aIcoLi.length-7)?'btn_scroll':'btn_scroll showBtn';
		iPrev.className=iNowUlLeft==0?'icon-prev':'icon-prev2';
		iNext.className=iNowUlLeft==(aIcoLi.length-3)?'icon-next2':'icon-next';
	}
	}
	for(i=0;i<aIcoLi.length;i++){
		aIcoLi[i].index=i;
		aIcoLi[i].onclick=function(){
			if(iNow==this.index){
				return false;
			}
			iNow=this.index;
			tab();
			product.id = $(".active a").attr("data");
		}
	}
	
	function tab(){
		for(i=0;i<aIcoLi.length;i++){
			aIcoLi[i].className='';
			investSum[i].style.display = 'none';
			//aPicLi[i].style.filter='alpha(opacity:0)';
			//aPicLi[i].style.opacity=0;
			aTextLi[i].getElementsByTagName('div')[0].className='';
			//miaovStopMove( aPicLi[i]);
		}
		aIcoLi[iNow].className='active';
		investSum[iNow].style.display = 'block';
		//aPicLi[this.index].style.filter='alpha(opacity:100)';
		//aPicLi[this.index].style.opacity=1;
		//miaovStartMove(aPicLi[iNow],{opacity:100},MIAOV_MOVE_TYPE.BUFFER);
		aTextLi[iNow].getElementsByTagName('div')[0].className='infoShow';
		
		var money = 0;
		if(product.usableSum>$(".active a").attr("investSum")){
				money = Math.floor($(".active a").attr("investSum"));
			}else if(product.usableSum<$(".active a").attr("investSum")){
				money = Math.floor(product.usableSum);
			}else{
				money = Math.floor(product.usableSum);
			}
		if(product.usableSum<50){
			$("#inputAmount").attr("placeholder","50起投，余额不足请充值");
		}else{
			$("#inputAmount").attr("placeholder","可购买金额50~"+money+"元");
		}
		if(product.sta==2){
		$("#inputAmount").attr("placeholder",$(".active a").attr("investSum")+"元(转让项目需全额购买)");
		}
	}
	
	function oUlleft(){
		oIcoUl.style.left=-aIcoLi[0].offsetWidth*iNowUlLeft+'px';
	}
	
	var money = 0;
	if(product.usableSum>$(".active a").attr("investSum")){
			money = Math.floor($(".active a").attr("investSum"));
		}else if(product.usableSum<$(".active a").attr("investSum")){
			money = Math.floor(product.usableSum);
		}else{
			money = Math.floor(product.usableSum);
		}
	if(product.usableSum<50){
		$("#inputAmount").attr("placeholder","50起投，余额不足请充值");
	}else{
		$("#inputAmount").attr("placeholder","可购买金额50~"+money+"元");
	}
	if(product.sta==2){
	$("#inputAmount").attr("placeholder",$(".active a").attr("investSum")+"元(转让项目需全额购买)");
	}

}